#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time   : 2021/7/4 11:45
# @Author : cjw
import allure

from app_wework_po.base.base_page import BasePage
from app_wework_po.setting import ELEMENT_YML
from app_wework_po.util.file_operator import YmlOperator
from app_wework_po.util.log import logger


class EditPersonPage(BasePage):
    """个人信息编辑页面"""

    # 添加元素定位数据到locators
    BasePage.locators.update(YmlOperator(ELEMENT_YML['epp']).data)

    def delete_person(self):
        """删除成员，跳转到通讯录页面"""
        from app_wework_po.page.contact_list_page import ContactListPage

        with allure.step(msg := '点击“删除成员”, 弹出删除成员确认弹出框'):
            logger.info(msg)
            self.tap(self.delete_person_btn)
        with allure.step(msg := f'点击“确定”按钮, 跳转到通讯录页面'):
            logger.info(msg)
            self.tap(self.delete_person_define)
        return ContactListPage(self.driver)
